xs: avoid pthread_join deadlock in xs_daemon_close
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 12 May 2010 07:49:13 +0000 (08:49 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 12 May 2010 07:49:13 +0000 (08:49 +0100)
commit990e331218dba6b671854cec24f639ff45763d7d
treee97efe2c1972c4a9bc696072f2fcadd0cdeaea3c
parent20a817b0a72cbc330d1278552aa8d328940d1e7c
xs: avoid pthread_join deadlock in xs_daemon_close

Doing a pthread_cancel and join on the reader thread while holding all
the request/reply/watch mutexes can deadlock if the thread needs to
take any of those mutexes to exit.  Kill off the reader thread before
taking any mutexes (which should be redundant if we're
single-threaded at that point).

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
tools/xenstore/xs.c